package com.wocai.jrt.orgadmin.feedback.service.impl;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import com.wocai.jrt.orgadmin.feedback.dao.FeedbackDao;
import com.wocai.jrt.orgadmin.feedback.model.Feedback;
import com.wocai.jrt.orgadmin.feedback.model.FeedbackBean;
import com.wocai.jrt.orgadmin.feedback.service.spi.FeedbackService;
import com.vteba.service.generic.impl.MyBatisServiceImpl;
import com.vteba.tx.jdbc.mybatis.spi.BaseDao;

/**
 * 意见反馈相关的service业务实现。
 * @author yinlei
 * @date 2015-8-20 15:53:24
 */
@Named
public class FeedbackServiceImpl extends MyBatisServiceImpl<Feedback, FeedbackBean, String> implements FeedbackService {
	// 添加了方法后，记得改为private
	protected FeedbackDao feedbackDao;
	
	@Override
	@Inject
	public void setBaseDao(BaseDao<Feedback, FeedbackBean, String> feedbackDao) {
		this.baseDao = feedbackDao;
		this.feedbackDao = (FeedbackDao) feedbackDao;
	}
	
	/**
	 * 获得意见反馈List
	 * @param model
	 * @return List<Feedback>
	 */
	@Override
	public List<Feedback> queryMyList(Feedback model) {
		return feedbackDao.queryMyList(model);
	}
	
	/**
     * 将反馈提交到平台
     * @param model
     * @return int
     */
	@Override
	public int submit(Feedback model) {
		return feedbackDao.submit(model);
	}
	
	 /**
     * 查看意见反馈详情页。
     * @param ID
     * @return 意见反馈详情页
     */
	@Override
	public Feedback getDetail(String id) {
		return feedbackDao.getDetail(id);
	}
	
	 /**
     * 添加反馈回复
     * @param model 
     * @return int
     */
	@Override
	public int addReply(Feedback model) {
		return feedbackDao.addReply(model);
	}
	
	/**
	 * 更新反馈状态为已回复
	 * @param feedbackId
	 * @return int
	 */
	@Override
	public int updateReplyState(String feedbackId) {
		return feedbackDao.updateReplyState(feedbackId);
	}
}
